package com.by.auto;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author 江俊俊
 * @version 1.0
 * @description
 * @date 2025/2/12 19:43
 * @since JDK1.8
 */
@ConfigurationProperties(prefix = "token.interceptor")
public class TokenInterceptionProperties {
    private final String[] DEFAULT_PATH_PATTERNS= {"/**"};//默认拦截所有请求;
    private final String[] DEFAULT_EXCLUDE_PATH_PATTERNS = {"/login"};//默认不拦截的请求

    String[] pathPatterns;//拦截的请求
    String[] excludePathPatterns;//不拦截的请求
    public String[] getPathPatterns() {
        if(pathPatterns==null){
            return DEFAULT_PATH_PATTERNS;
        }
        return pathPatterns;
    }

    public String[] getExcludePathPatterns() {
        if(excludePathPatterns==null){
            return DEFAULT_EXCLUDE_PATH_PATTERNS;
        }
        return excludePathPatterns;
    }

    public void setPathPatterns(String[] pathPatterns) {
        this.pathPatterns = pathPatterns;
    }
    public void setExcludePathPatterns(String[] excludePathPatterns) {
        this.excludePathPatterns = excludePathPatterns;
    }
}
